package LeetCode.month01.day10;

import java.util.ArrayList;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Map;

public class No155 {
}
class MinStack{
    Deque<Integer> deque;
    Deque<Integer> minDeque;

    public MinStack() {
        deque = new LinkedList<>();
        minDeque = new LinkedList<>();
        minDeque.push(Integer.MAX_VALUE);
    }

    public void push(int val) {
        deque.push(val);
        minDeque.push(Math.min(minDeque.peek(),val));
    }

    public void pop() {
        deque.pop();
        minDeque.pop();
    }

    public int top() {
        return deque.peek();
    }

    public int getMin() {
        return minDeque.peek();
    }
}
